From 37cfdc30d83880f5617176181cf414bdce52bfc2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 30 May 2014 10:03:12 -0700 Subject: [PATCH] Transaction coverage fix for doDeleteArticleReal * Do the FOR UPDATE select to get the ID *after* BEGIN, otherwise the locks will disappear right afterwards with the implicit commit. Change-Id: Ia531126cb4a86ec7789ceb7327d1c235c7aa979c --- includes/WikiPage.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8fe948b31b..e7af6ee421 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -2744,15 +2744,22 @@ class WikiPage implements Page, IDBAccessObject { return $status; } + $dbw = wfGetDB( DB_MASTER ); + $dbw->begin( __METHOD__ ); + if ( $id == 0 ) { $this->loadPageData( 'forupdate' ); $id = $this->getID(); if ( $id == 0 ) { + $dbw->rollback( __METHOD__ ); $status->error( 'cannotdelete', wfEscapeWikiText( $this->getTitle()->getPrefixedText() ) ); return $status; } } + // we need to remember the old content so we can use it to generate all deletion updates. + $content = $this->getContent( Revision::RAW ); + // Bitfields to further suppress the content if ( $suppress ) { $bitfield = 0; @@ -2765,11 +2772,6 @@ class WikiPage implements Page, IDBAccessObject { $bitfield = 'rev_deleted'; } - // we need to remember the old content so we can use it to generate all deletion updates. - $content = $this->getContent( Revision::RAW ); - - $dbw = wfGetDB( DB_MASTER ); - $dbw->begin( __METHOD__ ); // For now, shunt the revision data into the archive table. // Text is *not* removed from the text table; bulk storage // is left intact to avoid breaking block-compression or -- 2.20.1